import * as elIcons from '@element-plus/icons-vue'
import * as myIcons from '@/assets/icons'
import type { App } from 'vue'
import config from '@/config'
import directives from '@/directives/index'
import DxQrcode from '@/components/DxQrcode/index.vue'
import DxPasswordStrength from '@/components/DxPasswordStrength/index.vue'

export default {
  install(app: App) {
    //挂载全局对象
    app.config.globalProperties.$CONFIG = config
    //注册全局组件
    app.component('dxPasswordStrength', DxPasswordStrength)
    app.component('dxQrcode', DxQrcode)

    //注册全局指令
    app.use(directives)

    //统一注册el-icon图标
    for (let icon in elIcons) {
      app.component(`ElIcon${icon}`, elIcons[icon])
    }
    //统一注册my-icon图标
    for (let icon in myIcons) {
      app.component(`MyIcon${icon}`, myIcons[icon])
    }
  }
}
